package com.lsf.dunlian.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.lsf.dunlian.R;
import com.lsf.dunlian.activity.GroupChatActivity;
import com.lsf.dunlian.entity.AllNoticeRecordData;
import com.lsf.dunlian.entity.UserData;
import com.makeramen.roundedimageview.RoundedImageView;

import org.apache.commons.lang3.StringUtils;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class NoticeRecyclerViewAdapter extends RecyclerView.Adapter<NoticeRecyclerViewAdapter.ViewHolder> {
    private List<AllNoticeRecordData> mDataList;
    private Context context;

    public NoticeRecyclerViewAdapter(List<AllNoticeRecordData> mDataList, Context context) {
        this.mDataList = mDataList;
        this.context = context;
    }

    @NonNull
    @Override
    public NoticeRecyclerViewAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_notice, parent, false);
        NoticeRecyclerViewAdapter.ViewHolder holder = new NoticeRecyclerViewAdapter.ViewHolder(view);
        return holder;
    }

    @SuppressLint("SetTextI18n")
    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        AllNoticeRecordData recordData = mDataList.get(position);
        holder.content.setText(recordData.content);
        holder.name.setText(recordData.name);
        holder.time.setText(recordData.createTime);
        holder.lookNum.setText(recordData.lookNum);
    }

    @Override
    public int getItemCount() {
        return mDataList.size();
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.content)
        TextView content;
        @BindView(R.id.lookNum)
        TextView lookNum;
        @BindView(R.id.name)
        TextView name;
        @BindView(R.id.time)
        TextView time;
        public ViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }
    }
}
